Skip to content

apm: use url.template for OTLP HTTP client resource names - #54496

Open
niharikag09 wants to merge 5 commits into
DataDog:mainfrom
niharikag09:niharikag09/otel-url-template-resource-name
Open

apm: use url.template for OTLP HTTP client resource names#54496
niharikag09 wants to merge 5 commits into
DataDog:mainfrom
niharikag09:niharikag09/otel-url-template-resource-name

Conversation

@niharikag09

Copy link
Copy Markdown

What does this PR do?

Uses the OpenTelemetry url.template attribute when generating resource names for HTTP client spans. Client spans now use METHOD url.template when available and retain the method-only fallback otherwise. Server spans continue to use METHOD http.route.

Both the current and legacy OTLP resource-name paths are covered to keep behavior consistent when operation/resource name V2 is disabled.

Fixes #31570.

Motivation

HTTP client resource names currently collapse to the HTTP method even when OpenTelemetry instrumentation provides a low-cardinality URL template. Using the template produces more useful resource grouping without falling back to high-cardinality raw URLs.

Testing

Added focused unit coverage for client URL templates, method-only fallback, and client/server attribute precedence.

Local dda inv test --targets=./pkg/trace/api,./pkg/trace/otel/traceutil could not run because Windows Defender quarantined the standalone dda.exe after its PyPI bootstrap failed with a TLS handshake error. CI is expected to run the required test targets.

Additional Notes

The current commit is unsigned because no local signing key is configured; it will need to be replaced with a signed commit before merge.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@dd-octo-sts dd-octo-sts Bot added community team/opentelemetry OpenTelemetry team labels Aug 5, 2026
@niharikag09

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@niharikag09
niharikag09 marked this pull request as ready for review August 5, 2026 21:53
@niharikag09
niharikag09 requested a review from a team as a code owner August 5, 2026 21:53
@niharikag09
niharikag09 requested a review from IbraheemA August 5, 2026 21:53

@jade-guiton-dd jade-guiton-dd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR.

Comment thread pkg/trace/api/otlp.go Outdated
Comment thread pkg/trace/transform/otelutil.go Outdated
@niharikag09
niharikag09 requested review from a team as code owners August 6, 2026 20:38
@dd-octo-sts dd-octo-sts Bot added the team/agent-apm trace-agent label Aug 6, 2026
@niharikag09
niharikag09 force-pushed the niharikag09/otel-url-template-resource-name branch from be7a352 to 6e12b39 Compare August 6, 2026 22:46
@niharikag09

Copy link
Copy Markdown
Author

recheck

@jade-guiton-dd jade-guiton-dd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Comment thread pkg/trace/otel/traceutil/otel_util_test.go Outdated
@niharikag09

Copy link
Copy Markdown
Author

recheck

@niharikag09
niharikag09 force-pushed the niharikag09/otel-url-template-resource-name branch from 74e30ec to e708eed Compare August 10, 2026 04:57
@niharikag09
niharikag09 requested review from a team, aiuto, cmourot and quentinus95 as code owners August 10, 2026 04:57
@niharikag09
niharikag09 force-pushed the niharikag09/otel-url-template-resource-name branch from d041ebb to 50e2120 Compare August 10, 2026 05:16
@niharikag09

Copy link
Copy Markdown
Author

recheck

@vickenty
vickenty removed the request for review from a team August 10, 2026 08:16
@hush-hush
hush-hush removed request for a team and hush-hush August 12, 2026 08:50
@brycekahle
brycekahle removed the request for review from a team August 12, 2026 17:52
@aiuto

aiuto commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Is someone internal shepherding this PR? It will never land with this many spurious approvers needed. You should reduce it to the teams that actually own the code.

@niharikag09

Copy link
Copy Markdown
Author

@jade-guiton-dd @aiuto Can you please remove the other code owners, I dont have permissions to remove

@aiuto

aiuto commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

@jade-guiton-dd @aiuto Can you please remove the other code owners, I dont have permissions to remove

@niharikag09 Sorry that I was not clear. I meant the DataDog employee shepherding this in should find the right owners and fix it. While I could do that, it should really belong to someone with knowledge of the OTel code. I'm just trying to work on process so that we don't let PRs like this stall forever.

@niharikag09

Copy link
Copy Markdown
Author

@IbraheemA can you please review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improved resource naming for HTTP client requests

3 participants